<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //边界符 , ^ $
    var rg = /abc/ //正则不需要写引号
    // /abc/ 代表只要包含有 abc 这个字符串就满足正则规则
    console.log(rg.test('abc'));

    //限定开头
    var rg =/^abc/
    console.log(rg.test('abc'));
    console.log(rg.test('aabc'));
    
    //限定结尾
    var rg = /abc$/
    console.log(rg.test('abc'));
    console.log(rg.test('aabc'));

    //必须完全匹配
    var rg =/^abc$/
  </script>
</body>
</html>